﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UITesting;
using BackOffice.Context.UltiPro.BackOfficeUIMapClasses;
using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

namespace BackOffice.Context.UltiPro.PageObjects
{
    /// <summary>
    /// Code Setup screen
    /// </summary>
    public static class CodeSetup
    {
        private static BackOfficeUIMap UIMap
        {
            get
            {
                return new BackOfficeUIMap();
            }
        }

        public static WinEdit Country
        {
            get
            {
                return UIMap.UIULTIPROWindow.UICodeSetupWindow.UICodeSetupCountry.Country;
            }
        }

        public static WinEdit Date
        {
            get
            {
                return UIMap.UIULTIPROWindow.UICodeSetupWindow.UICodeSetupDate.Date;
            }
        }

        public static WinEdit Description
        {
            get
            {
                return UIMap.UIULTIPROWindow.UICodeSetupWindow.UICodeSetupDescription.Description;
            }
        }

        public static UITestControl TopPanel
        {
            get
            {
                return UIMap.UIULTIPROWindow.UICodeSetupWindow.UITopPanel.TopPanel;
            }
        }

        public static WinTree TreeView
        {
            get
            {
                return UIMap.UIULTIPROWindow.UICodeSetupWindow1.UICodeTreeView.CodeTreeView;
            }
        }

        public static WinTreeItem TreeItemCode(string code)
        {
            WinTreeItem item = new WinTreeItem(TreeView);
            #region Search Criteria
            item.SearchProperties[WinTreeItem.PropertyNames.Name] = code;
            item.SearchProperties["Value"] = "0";
            item.WindowTitles.Add("ULTIPRO - [Code Setup]");
            #endregion

            return item;
        }
    }
}
